package com.aeasycredit.test;

import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.InetSocketAddress;
import java.net.Socket;

public class ClientOne {

	public static void main(String[] args) throws UnsupportedEncodingException, IOException {
	    // 要连接的服务端IP地址和端口
	    String host = "127.0.0.1"; 
	    int port = 18080;
	    // 与服务端建立连接
	    //Socket socket = new Socket(host, port);
	    Socket socket = new Socket();
	    socket.connect(new InetSocketAddress(host, port), 30000);
        socket.setSoTimeout(60000);
	    // 建立连接后获得输出流
	    OutputStream outputStream = socket.getOutputStream();
	    String message="你好  yiwangzhibujian";
	    socket.getOutputStream().write(message.getBytes("UTF-8"));
	    outputStream.close();
	    socket.close();
	}

}
